package main
import "fmt"

func main(){
	var dict map[string]string = make(map[string]string)

	// 增
	dict["name"] = "lilisi"
	dict["age"] = "18"
	dict["sex"] = "man"
	dict["address"] = "beijing"
	fmt.Println(dict)

	// 删
	delete(dict, "address")

	// 改
	dict["age"] = "28"

	// 查--获取值
	name := dict["name"]
	height, ok := dict["height"]
	if ok == false{
		fmt.Println("没有key 'height'")
	}
	fmt.Printf("name=%s, height=%s\n", name, height)

	// 遍历
	for k, v := range dict{
		fmt.Printf("key=%s, value=%s\n", k, v)
	}

	// 长度
	fmt.Println(len(dict))

}
